#ifndef __DAC_H
#define __DAC_H

#include "stm32f1xx.h"

void dac_init(uint8_t outx);                      /* DAC通道1初始化 */
void dac_set_voltage(uint8_t outx, uint16_t vol); /* 设置通道1/2输出电压 */

void dac_triangular_wave(uint16_t maxval, uint16_t dt, uint16_t samples, uint16_t n); /* 输出三角波 */

void dac_dma_wave_init(uint8_t outx, uint32_t par, uint32_t mar);     /* DAC DMA输出波形初始化函数 */
void dac_dma_wave_enable(uint16_t cndtr, uint16_t arr, uint16_t psc); /* DAC DMA输出波形使能 */

#endif
